using System;
using System.Data;
using System.Collections.Generic;
using System.Text;

namespace demo_doan
{
    class Sach : Interface
    {
        protected string masach;
        protected string matheloai;
        protected string tensach;
        protected string tacgia;
        protected int namxuatban;
        protected string nhaxuatban;
        protected DateTime ngaynhap;
        protected int giasach;
        protected int soluong;
        protected string nguoitiepnhan;
        protected int tinhtrang;

        public int TinhTrang
        {
            get { return tinhtrang; }
            set { tinhtrang = value; }
        }
	
        public string NguoiTiepNhan
        {
            get { return nguoitiepnhan; }
            set { nguoitiepnhan = value; }
        }
	
        public int SoLuong
        {
            get { return soluong; }
            set { soluong = value; }
        }
	
        public int GiaSach
        {
            get { return giasach; }
            set { giasach = value; }
        }
	
        public DateTime NgayNhap
        {
            get { return ngaynhap; }
            set { ngaynhap = value; }
        }
	
        public string NhaXuatBan
        {
            get { return nhaxuatban; }
            set { nhaxuatban = value; }
        }
	
        public int NamXuatBan
        {
            get { return namxuatban; }
            set { namxuatban = value; }
        }
	
        public string TacGia
        {
            get { return tacgia; }
            set { tacgia = value; }
        }
	
        public string TenSach
        {
            get { return tensach; }
            set { tensach = value; }
        }
	
        public string MaTheLoai
        {
            get { return matheloai; }
            set { matheloai = value; }
        }
	
	
        public string MaSach
        {
            get { return masach; }
            set { masach = value; }
        }

        public Sach() { }
        public Sach(string ms,string mtt,string ts,string tg,int naxb,string nxb,DateTime nn,int gs,int sl,string ntn,int tt)
        {
            masach = ms;
            matheloai = mtt;
            tensach = ts;
            tacgia = tg;
            namxuatban = naxb;
            ngaynhap = nn;
            giasach = gs;
            soluong = sl;
            nguoitiepnhan = ntn;
            tinhtrang = tt;
        }
        public Sach(Sach s)
        {
            masach = s.MaSach;
            matheloai = s.MaTheLoai;
            tensach = s.TenSach;
            tacgia = s.TacGia;
            namxuatban = s.NamXuatBan;
            nhaxuatban = s.NhaXuatBan;
            ngaynhap = s.NgayNhap;
            giasach = s.GiaSach;
            soluong = s.SoLuong;
            nguoitiepnhan = s.NguoiTiepNhan;
            tinhtrang = s.TinhTrang;
        }
        public override void Insert(string sql)
        {
            Provider prv = new Provider("server=TILOM8X-PC\\SQLEXPRESS; Database=QuanLyThuVien; Integrated security=true");
            prv.ExeQuery(sql);
        }
        public override void Update(string sql)
        {
            Provider prv = new Provider("server=TILOM8X-PC\\SQLEXPRESS; Database=QuanLyThuVien; Integrated security=true");
            prv.ExeQuery(sql);
        }
        public override void Delete(string sql)
        {
            Provider prv = new Provider("server=TILOM8X-PC\\SQLEXPRESS; Database=QuanLyThuVien; Integrated security=true");
            prv.ExeQuery(sql);
        }
        public override DataTable Select(string sql)
        {
            Provider prv = new Provider("server=TILOM8X-PC\\SQLEXPRESS; Database=QuanLyThuVien; Integrated security=true");
            return prv.ExecuteQuery(sql);
        }     
    }
}
